#include "SQLUnaryExpr.h"
#include "../../visitor/SQLASTVisitor.h"

SQLUnaryExpr::SQLUnaryExpr()
{
}

SQLUnaryExpr::~SQLUnaryExpr()
{
  // if (expr != NULL)
  // {
  //   // delete expr;
  //   expr = NULL;
  // }

  // if (xoperator != NULL)
  //{
  // delete xoperator;
  // xoperator = NULL;
  //}
}
SQLUnaryExpr::SQLUnaryExpr(SQLUnaryOperator_ptr theXoperator, SQLExpr_ptr theExpr)
    : xoperator(theXoperator), expr(theExpr)
{
  // this.xoperator = xoperator;
  // this.expr = expr;
}

SQLUnaryOperator_ptr SQLUnaryExpr::getOperator()
{
  return xoperator;
}

void SQLUnaryExpr::setOperator(SQLUnaryOperator_ptr theXoperator)
{
  xoperator = theXoperator;
}

SQLExpr_ptr SQLUnaryExpr::getExpr()
{
  return expr;
}

void SQLUnaryExpr::setExpr(SQLExpr_ptr theExpr)
{
  expr = theExpr;
}

void SQLUnaryExpr::accept0(SQLASTVisitor_ptr visitor)
{
  if (visitor->visit(SharedObject(SQLUnaryExpr)))
  {
    acceptChild(visitor, expr);
  }

  visitor->endVisit(SharedObject(SQLUnaryExpr));
}

// int SQLUnaryExpr::hashCode() {
// int prime = 31;
// int result = 1;
// result = prime * result + ((expr == null) ? 0 : expr.hashCode());
// result = prime * result + ((xoperator == null) ? 0 : xoperator.hashCode());
// return result;
//}

// BOOL_ptr SQLUnaryExpr::equals(Object obj) {
// if (this == obj) {
// return BOOL::TRUE;
//}
// if (obj == null) {
// return BOOL::FALSE;
//}
// if (getClass() != obj.getClass()) {
// return BOOL::FALSE;
//}
// SQLUnaryExpr other = (SQLUnaryExpr) obj;
// if (expr == null) {
// if (other.expr != null) {
// return BOOL::FALSE;
//}
//} else if (!expr.equals(other.expr)) {
// return BOOL::FALSE;
//}
// if (xoperator != other.xoperator) {
// return BOOL::FALSE;
//}
// return BOOL::TRUE;
//}
